<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;

class ArticleTypeUpdateRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'super_tag_id' => 'required|numeric',
            'name'         => 'required|string',
            'summary'      => 'sometimes|string',
            'thumb'        => 'sometimes',
            'sort'         => 'required|numeric',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'super_tag_id.*' => '文章的类别必须是数字',
            'name.*'         => '文章类别名必须是字符串',
            'summary.*'      => '文章类别的详情必须是字符串',
            'thumb.*'        => '文章类别的缩略图必须小于2M',
            'sort.*'         => '文章类别的排序必须是数字',
        ];
    }
}
